<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>worker blob</title>
</head>
<body>

<script>
    window.URL = window.URL || window.webkiURL;

    var blob = new Blob(["onmessage = function(e) { postMessage('msg from worker'); }"]);

    // Obtain a blob URL reference to our worker 'file'.
    var blobURL = window.URL.createObjectURL(blob);

    var worker = new Worker(blobURL);
    worker.onmessage = function (e) {
        alert(e.data);
    };
    worker.postMessage(); // Start the worker.
</script>

</body>
</html>